/*
 * @(#)AccountDaoImpl.java	1.00 10/06/25
 *
 * Copyright 2010 Kmdigit, Inc. All rights reserved.
 * KMdigit PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

package kmdigit.dao.persistance.ibatis;

import com.ibatis.dao.client.DaoManager;
import com.ibatis.dao.client.template.SqlMapDaoTemplate;
import kmdigit.dao.domain.Account;
import kmdigit.dao.persistance.AccountDao;

/**
 * @author  Kyunam Lee
 * @version 1.00, 06/25/10
 */

public class AccountDaoImpl extends SqlMapDaoTemplate implements AccountDao 
{
	public AccountDaoImpl(DaoManager daoManager)
	{
		super(daoManager);
	}
	
	@Override
	public int delete(Account account) 
	{
		//AccountDaoImpl.delete(String)
		return delete(account.getUserid());
	}

	@Override
	public int delete(String accountId) 
	{
		//SqlMapDaoTemplate.delete
		return delete("Account.delete", accountId);
	}

	@Override
	public Account getById(String accountId) 
	{
		return (Account)queryForObject("Account.getById", accountId);
	}

	@Override
	public Account getById(Account account) 
	{
		return getById(account.getUserid());
	}

	@Override
	public Integer insert(Account account) 
	{
		//SqlMapDaoTemplate.insert
		return (Integer)insert("Account.insert", account);
	}

	@Override
	public int update(Account account) 
	{
		//SqlMapDaoTemplate.update
		return update("Account.update", account);
	}
}
